package doyouknow.group.CnAndZhb.service.impl;

import doyouknow.group.CnAndZhb.entity.TblUserLoginLog;
import doyouknow.group.CnAndZhb.dao.master.TblUserLoginLogDao;
import doyouknow.group.CnAndZhb.service.TblUserLoginLogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (TblUserLoginLog)表服务实现类
 *
 * @author cn
 * @since 2020-11-03 20:50:41
 */
@Service("tblUserLoginLogService")
public class TblUserLoginLogServiceImpl implements TblUserLoginLogService {
    @Resource
    private TblUserLoginLogDao tblUserLoginLogDao;

    /**
     * 通过ID查询单条数据
     *
     * @param loginlogidx 主键
     * @return 实例对象
     */
    @Override
    public TblUserLoginLog queryById(Integer loginlogidx) {
        return this.tblUserLoginLogDao.queryById(loginlogidx);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<TblUserLoginLog> queryAllByLimit(int offset, int limit) {
        return this.tblUserLoginLogDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param tblUserLoginLog 实例对象
     * @return 实例对象
     */
    @Override
    public TblUserLoginLog insert(TblUserLoginLog tblUserLoginLog) {
        this.tblUserLoginLogDao.insert(tblUserLoginLog);
        return tblUserLoginLog;
    }

    /**
     * 修改数据
     *
     * @param tblUserLoginLog 实例对象
     * @return 实例对象
     */
    @Override
    public TblUserLoginLog update(TblUserLoginLog tblUserLoginLog) {
        this.tblUserLoginLogDao.update(tblUserLoginLog);
        return this.queryById(tblUserLoginLog.getLoginlogidx());
    }

    /**
     * 通过主键删除数据
     *
     * @param loginlogidx 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer loginlogidx) {
        return this.tblUserLoginLogDao.deleteById(loginlogidx) > 0;
    }
}